<%--
  Created by IntelliJ IDEA.
  User: 旭哥
  Date: 2018/10/15
  Time: 16:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>Title</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
    <script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>
<style>
    #tableone{
        margin-top: 30px;
        width: 100%;
        height: 10%;
        border: 1px solid #D9D9D9;
        border-collapse:collapse;
    }
    #tableone td{
        border: 1px solid #D9D9D9;
        border-left:0px solid #D9D9D9;
        border-right:0px solid #D9D9D9;
        height: 50px;
    }
    #tableonetr{
        background: -webkit-linear-gradient(#FFFFFF, #F5F5F5);
    }
</style>
<body>
<table id="tableone">

    <tr id="tableonetr">

        <td>编号</td>
        <td>成品库存数量</td>
        <td>库存数量</td>
        <td>仓库编号</td>
        <td>仓库名称</td>
        <td>说明</td>
        <td>操作</td>
    </tr>


    <tbody id="entrepottab">
    <tr v-for="entrepot in entrepotlist" >
        <td>{{entrepot.entrid}}</td>
        <td>{{entrepot.fpnum}}</td>
        <td>{{entrepot.repnum}}</td>
        <td>{{entrepot.entrcode}}</td>
        <td>{{entrepot.entryname}}</td>
        <td>{{entrepot.entrmark}}</td>
        <td><button @click="del(use.usersid)">删除</button></td>
    </tr>
    </tbody>

</table>
<div id="fenye">
    <button class='btn btn-info btn-sm' @click="shang(1)" style="font-weight:bold;margin-left:500px;font-family: 楷体;font-size: 15px"type="button" >上一页</button>
    {{currentPage}}
    <button class='btn btn-info btn-sm'  @click="xia(1)" style="font-weight:bold;font-family: 楷体;font-size: 15px" type="button" >下一页</button>
    <span style="font-family: 楷体;font-size: 20px">总{{MaxPage}}页</span>

</div>
</body>
</html>
<script>

    $(function(){
        load.fenye(1);
    })

    var load= new Vue({
        el:"#entrepottab",
        data:{
            entrepotlist:"",
        },
        methods:{
            fenye: function (pageNum){
                var url = "/entrepot/queryentrepot/"+pageNum; //   前面要加/
                this.$http.post(url).then(function (data) {//ajax请求封装
                    fan.currentPage= data.body.pageNum;
                    fan.MaxPage=data.body.pages;
                    this.entrepotlist=data.body.list;
                }, function(a){   //返回失败方法调用，暂不处理
                })}
        },del:function(usersid){
            alert("123");
            var url="/entrepot/delUsers"+usersid;
            this.$http.post(url).then(function(res){
                if(res.body.status===0){
                    res.body=this.fenye();
                }

            })
        }
    })

    var fan=new Vue({
        el:"#fenye",
        data:{
            currentPage:"",
            MaxPage:"",
        },
        methods:{
            shang:function(pageNum){
                if(this.currentPage-pageNum==0){
                    pageNum=1;
                }else{
                    pageNum=this.currentPage-pageNum;
                }
                load.fenye(pageNum)
            },xia:function(pageNum){
                if(this.currentPage+pageNum>this.MaxPage){
                    pageNum=this.currentPage;
                }else{
                    pageNum=this.currentPage+pageNum;
                }
                load.fenye(pageNum);
            }
        }

    })



</script>